//
//  HQVerticalButton.swift
//  TodayNews
//
//  Created by 郝庆 on 16/8/22.
//  Copyright © 2016年 haoqing. All rights reserved.
//

import UIKit

class HQVerticalButton: UIButton {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        titleLabel?.textAlignment = .Center
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        titleLabel?.textAlignment = .Center
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        // 调整图片
        imageView?.hq_centerX = self.hq_width * 0.5
        imageView?.hq_y = kMargin
        imageView?.hq_width = 24
        imageView?.hq_height = imageView!.hq_width
        // 调整文字
        titleLabel?.hq_x = 0
        titleLabel?.hq_y = imageView!.hq_height
        titleLabel?.hq_width = self.hq_width
        titleLabel?.hq_height = self.hq_height - self.titleLabel!.hq_y
    }
    
}
